import {createRouter,createWebHistory} from 'vue-router';
import Home from '@/views/Home.vue';
//创建路由配置
const routes = [
    {
        path:'/',
        redirect:'/home'
    },
    {
        name:'home',
        path:'/home',
        component:Home
    },
    {
        name:'category',
        path:'/category',
        component:()=>import('@/views/Category.vue')
    },
    {
        name:'cart',
        path:'/cart',
        component:()=>import('@/views/Cart.vue')
    },
    {
        name:'user',
        path:'/user',
        component:()=>import('@/views/User.vue')
    }
]
//可以创建路由的实例
const router = createRouter({
    history:createWebHistory(),
    routes
})
export default router;